package l1j.opqlo.AutoPay;

import java.util.Calendar;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;

public class MyPay_temp {

	private String account_name;
	private int _objid;
	private int _amount;
	private int _sob;
	private int _tradeId;
	private long _paytime;

	private static final String TOKEN1 = "/";

	private static final String TOKEN2 = ":";

	private static final Logger _log = Logger.getLogger(MyPay_temp.class
			.getName());

	public String getAccountName() {
		return this.account_name;
	}

	public int getAmount() {
		return this._amount;
	}

	public int getObjId() {
		return this._objid;
	}

	public long getPayTime() {
		return this._paytime;
	}

	public int getSob() {
		return this._sob;
	}

	public int getTradeId() {
		return this._tradeId;
	}

	private String[] minus(final String s, final String s2) {
		try {
			final StringTokenizer st = new StringTokenizer(s, TOKEN1);
			String sTemp = null;

			final String[] iReturn = new String[6];
			for (int i = 0; i < 3; i++) {
				sTemp = st.nextToken();
				iReturn[i] = sTemp;
			}
			final StringTokenizer st2 = new StringTokenizer(s2, TOKEN2);
			for (int i = 3; i < 6; i++) {
				sTemp = st2.nextToken();
				iReturn[i] = sTemp;
			}
			return iReturn;
		} catch (final Exception e) {
			_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
		}
		return null;
	}

	public void remove() {
		this.account_name = null;
		this._objid = 0;
		this._amount = 0;
		this._sob = 0;
		this._tradeId = 0;
		this._paytime = 0;
	}

	public void setAccountName(final String s) {
		this.account_name = s;
	}

	public void setAmount(final int i) {
		this._amount = i;
	}

	public void setObjId(final String s) {
		this._objid = Integer.valueOf(s);
	}

	public void setPayTime(final String s1, final String s2) {

		String[] s = null;
		try {
			s = this.minus(s1, s2);
			this._paytime = this.ss(s);

		} catch (final Exception e) {
			_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
		}
	}

	public void setSob(final String s) {
		this._sob = Integer.valueOf(s);
	}

	public void setTradeId(final int i) {
		this._tradeId = i;
	}

	public long ss(String[] s) {
		if (s == null) {
			return 0;
		}
		final Calendar calendar = Calendar.getInstance();
		final int[] day = new int[s.length];
		for (int i = 0; i < s.length; i++) {
			day[i] = Integer.valueOf(s[i]);
		}
		// Date trialTime = new Date();
		calendar.set(day[0], day[1] - 1, day[2], day[3], day[4], day[5]);
		return calendar.getTime().getTime();

		// return (int) ((calendar.getTime().getTime() -
		// System.currentTimeMillis()) /60000);

	}
}
